package com.cloud.spring;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ResourceLoaderAware;
import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Component;

import com.cloud.server.OrderController;

import lombok.extern.slf4j.Slf4j;

@Component
@Slf4j
public class ServiceBeanDefinitionRegistry implements BeanFactoryPostProcessor, ResourceLoaderAware, ApplicationContextAware {@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void setResourceLoader(ResourceLoader resourceLoader) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
		OrderController orderController = new OrderController();
		beanFactory.registerSingleton(OrderController.class.getName(), new ServiceFactory(orderController));
	}

}